//
//  WNVistorViewController.swift
//  XLWeibo
//
//  Created by 风不会停息 on 2017/7/24.
//  Copyright © 2017年 风不会停息. All rights reserved.
//

import UIKit

class WNVistorViewController: UITableViewController {

    var isLogin : Bool = WNUserAccountViewModel.sharedViewModel.isLogin
    
    var visitorView : WNVistorView?
    
    override func loadView() {
        
        if isLogin {
            
            super.loadView()
        }else{
            
            visitorView = WNVistorView()
            
            //设置导航栏
            setupNavUI()
            
            view = visitorView
        }
        
    }
    
    //设置导航栏方法
    func setupNavUI ()
    {
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", target: self, action: #selector(registerAciton))
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", target: self, action: #selector(loginAciton))
    }
    
    @objc private func registerAciton()
    {
        //注册
        entherLogin()
    }
    
    @objc private func loginAciton()
    {
        //登录
        entherLogin()
        
    }
    
    //进入微博登录界面
    private func entherLogin(){
        
        let AuthVC = WNAuthViewController()
        
        let nav = WNNavViewController(rootViewController: AuthVC)
        
        self.present(nav, animated: true, completion: nil)
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}
